home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byt1186b.arc / RUNGKUT.LBR / RUNKUT.DOC < prev    next >
Text File  |  1986-04-11  |  29KB  |  794 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           1. RUNKUT - AN INITIAL VALUE ORDINARY DIFFERENTIAL EQUATION
  8.           SOLVER.
  9.  
  10.  
  11.  
  12.           1.1. INTRODUCTION
  13.  
  14.           RUNKUT is a subroutine that contains three Runge-Kutta initial
  15.           value ordinary differential equation (IVP ODE) solvers They are:
  16.  
  17.           -   A fourth order Fehlberg method.
  18.           -   A fifth order Verner method.
  19.           -   An seventh order Verner method.
  20.  
  21.           RUNKUT solves coupled IV ODE's of the form:
  22.  
  23.                Y' = F(x,Y)
  24.  
  25.           There is no limit to the number of coupled equations in a system
  26.           to be solved other than the amount of memory available. The
  27.           differential equations are defined in a user-supplied
  28.           subroutine--more about that later.  The subroutine is called
  29.           using the following FORTRAN call statement:
  30.  
  31.                   CALL RUNKUT(XA,Y,XB,NEQN,TOLA,TOLR,HSTART,WORK,
  32.                 &           IMETH,IERROR,ICOM,FUNC)
  33.  
  34.           and must be called from a main "calling" program.
  35.  
  36.  
  37.  
  38.           1.2. VARIABLES PASSED TO RUNKUT.
  39.  
  40.           The variables passed are explained below and are listed in the
  41.           order in which they appear in the call statement. The
  42.           superscripted numbers refer to notes appearing at the end of this
  43.           section.
  44.  
  45.           XA (Real-Input)
  46.               XA is the starting point of the interval over which
  47.               integration of the ODE's is to be performed.(1)
  48.  
  49.           Y (Real array of size NEQN - Input/Output)
  50.               On entry, Y must contain the initial values of the
  51.               Y-variables--that is Y must contain the solutions at the
  52.               point XA. On exit from RUNKUT, Y will contain the solutions
  53.               at the end of the specified interval--that is at XB.(2)
  54.  
  55.           XB (Real-Input)
  56.               XB specifies the end of the interval over which integration
  57.               is to be performed--the point at which solutions to the
  58.               differential equations are desired.(1,2)
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           NEQN (Integer-Input)
  74.               NEQN specifies the number of coupled differential equations
  75.               in the system to be solved.
  76.  
  77.           TOLA (Real-Input)
  78.               TOLA is the absolute error tolerance required on the
  79.               solution.(3)
  80.  
  81.           TOLR (Real-Input)
  82.               TOLR is the relative error tolerance required on the
  83.               solution.(3)
  84.  
  85.           HSTART (Real-Input/Output)
  86.               On the very first call to RUNKUT in a calling sequence,
  87.               HSTART must contain a non-zero value as an initial estimate
  88.               for the step-size.(1) The actual value used is relatively
  89.               unimportant as the program will optimize step-sizes to keep
  90.               the tolerances within specified limits and keep the number of
  91.               function evaluations to a minimum. It is left to the user's
  92.               discretion to choose a value that will not require excessive
  93.               readjustment by the program.  On exit from RUNKUT, this
  94.               variable will contain the last step size used by the program.
  95.               It is recommended that for subsequent calls to RUNKUT, the
  96.               step size returned by the program be used as the value for
  97.               HSTART to solve the equations over the immediately following
  98.               interval.
  99.  
  100.           WORK (Real array of minimum size NEQN*17 - Input)
  101.               This is a work area made available to RUNKUT by the calling
  102.               program.
  103.  
  104.           IMETH (Integer-Input)
  105.               Indicates to the solver, the order of the method to be used.
  106.               IMETH can take on the following values:
  107.  
  108.               1.  - Fourth order Fehlberg method
  109.               2.  - fifth order Verner method
  110.               3.  - seventh order Verner method
  111.  
  112.               While solving a given set of differential equations it is
  113.               possible to change the order of the method over sucessive
  114.               intervals simply by setting IMETH to the desired value and
  115.               resetting ICOM(1) to 0 on each subsequent call to RUNKUT in
  116.               which a change of order is required.(4)
  117.  
  118.           IERROR (Integer-Output)
  119.               IERROR is an error status indicator returned by RUNKUT after
  120.               each call.  It can have one of the following values:
  121.  
  122.               0 - no error.
  123.               1 - the sum of TOLA and TOLR is less than 100 times machine
  124.                   epsilon. This can be caused by setting both TOLA and TOLR
  125.                   to 0, or by specifying values that are too small for the
  126.                   program to handle sucessfully. In this case TOLR is set
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                   to a default value.
  140.               2 - the problem is too stiff for the method to handle, or
  141.                   there is a discontinuity in the function. It is
  142.                   impossible to proceed in either case.(2)
  143.               3 - both conditions 1 and 2 above have occured.
  144.  
  145.               IERROR is set to 0 on every entry to RUNKUT.
  146.  
  147.           ICOM (Integer array of size 4)
  148.               ICOM is a communications vector.  Each array element is used
  149.               to pass a specific item of information (as defined below) to
  150.               and from the subroutine.
  151.  
  152.           ICOM(1) (Input)
  153.               ICOM(1) must be set to 0 on the first call to RUNKUT.
  154.               ICOM(1) is internally set to a non-zero value by the program
  155.               after the first call. For subsequent calls to RUNKUT with the
  156.               same set of equations, ICOM(1) must be left at this non-zero
  157.               value. It is possible to change the order of the method used
  158.               (see also IMETH) over sucessive intervals. In this case
  159.               ICOM(1) must be reset to 0 each time the order of the method
  160.               is changed.(4)
  161.  
  162.           ICOM(2) (Input)
  163.               A flag that indicates to the program whether to perform
  164.               checks on the specified values of TOLA and TOLR.
  165.  
  166.               0 - no checking  of the error tolerances.
  167.               1 - program checks if the sum of TOLA and TOLR is at least
  168.                   100 times machine epsilon. If not, TOLR is set to a
  169.                   default value and the error indicator IERROR is set to 1.
  170.  
  171.               If ICOM(2) is set to 0, the program assumes that it will be
  172.               receiving non-zero values of at least one of TOLA or TOLR.
  173.               Failure to check this before entry to RUNKUT could result in
  174.               fatal program errors.  Also, as will be shown in an example,
  175.               decreasing the error tolerances does not always result in
  176.               improved solution accuracy.
  177.  
  178.           ICOM(3) (Input)
  179.               A flag that indicates to the program whether to use the
  180.               default values of mimimum and maximum step size set by the
  181.               subroutine.(5)
  182.  
  183.               0 - default values of the maximum and minimum step size are
  184.                   used.
  185.               1 - allows the user to set values for the maximum and minimum
  186.                   permissible step size. These values are set by including
  187.                   the following FORTRAN common block statement in the main
  188.                   "calling" program:
  189.  
  190.                      COMMON /CONS/HMIN,HMAX
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.               ICOM(4) (Output)
  206.                   Status flag that indicates the presence of round-off
  207.                   error in the solution.
  208.                   0 - No round-off error.
  209.                   1 - Severe round-off error possible in answer.
  210.  
  211.                   ICOM(4) is reset to 0 on entry to RUNKUT.
  212.  
  213.               FUNC (Function name)
  214.                   FUNC is replaced by the name of the subroutine that is
  215.                   part of the main user routine in which the differential
  216.                   equations are specified (See section on user supplied
  217.                   routines). The subroutine name must be declared external
  218.                   by the following FORTRAN statement:
  219.  
  220.                      EXTERNAL [SUBROUTINE NAME].
  221.  
  222.  
  223.               1.2.1. NOTES
  224.  
  225.               1.  XA could be greater than XB. In other words it is
  226.                   possible to use RUNKUT to solve the differential
  227.                   equations in a negative X-direction given initial values
  228.                   at XA. In that case the step-size will also be negative.
  229.                   HSTART could be specified as a negative value, but that
  230.                   is not essential as the program internally adjusts the
  231.                   algebraic sign of the step-size.
  232.  
  233.               2.  If a discontinuity or extreme stiffness is encountered,
  234.                   RUNKUT will return in XB, the value of X closest to the
  235.                   point of discontinuity or stiffness, at which the
  236.                   solutions are still within the specified error bounds.
  237.                   The array Y will then contain solutions at this value of
  238.                   X.
  239.  
  240.               3.  If the sum of TOLA and TOLR is less than 100 times
  241.                   machine epsilon (for example if neither were defined in
  242.                   the main program), TOLR is set to a default value of
  243.                   10(6) times machine epsilon. TOLA is not set to any
  244.                   default value. The program uses a combination of TOLA and
  245.                   TOLR to determine the accuracies of the solutions, and
  246.                   specifying TOLR to a certain value almost always gives
  247.                   better results than specifying TOLA to the same value.
  248.  
  249.               4.  Changing the order of the method on every subsequent call
  250.                   to RUNKUT with a given system of equations can lead to
  251.                   excessive computaion times since a large number of
  252.                   constants are re-evaluated each time the order is
  253.                   changed.
  254.  
  255.               5.  The default values used by the subroutine are 10(-8) for
  256.                   HMIN, and for HMAX as follows:
  257.  
  258.                   0.5 - if the fourth order method is used.
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                   1.0 - if the fifth order method is used.
  272.                   2.0 - if the seventh order method is used.
  273.  
  274.                   However, if any of these values are larger than the
  275.                   absolute value of the interval width, HMAX is set to the
  276.                   interval width. It is sometimes necessary to specify HMAX
  277.                   to a small value to keep the step sizes to relatively
  278.                   small values that keep the runge-kutta methods within
  279.                   regions of stability. The subroutine detects the onset of
  280.                   problem "stiffness" or the occurence of a discontinuity
  281.                   in the function by checking if the step size is smaller
  282.                   than HMIN. If the equations are being solved in the
  283.                   negative X-direction, HMIN and HMAX are the smallest and
  284.                   largest permissible step sizes in the negative
  285.                   X-direction respectively.  In other words, HMIN and HMAX
  286.                   always define absolute constraints on the step size.
  287.  
  288.               6.  Machine epsilon on the IBM PC is very much a function of
  289.                   the compiler used (even with an 8087 math coprocessor
  290.                   installed). For example Microsoft's Fortran-77 compiler
  291.                   (with 8087 support) generates an epsilon of about
  292.                   10(-16), whereas IBM/Ryan-McFarland's Professional
  293.                   Fortran-77 generates an epsilon of about 10(-20)
  294.  
  295.  
  296.  
  297.               1.3. THE USER-SUPPLIED ROUTINES
  298.  
  299.               Two routines must be supplied:
  300.  
  301.               1.  A main "calling" program that calls RUNKUT. It must also
  302.                   define the initial values of Y at XA, set TOLA and TOLR,
  303.                   set ICOM(1) to 0 on the first call to RUNKUT, define the
  304.                   number of equations in the sytstem to be solved,
  305.                   dimension a WORK array for RUNKUT, and check for the
  306.                   error status as passed back from RUNKUT through IERROR.
  307.                   See the examples at the end of this section.
  308.  
  309.  
  310.               2.  A subroutine containing the system of differential
  311.                   equations.  The subroutine name must be declared EXTERNAL
  312.                   in the main calling program and its name passed to RUNKUT
  313.                   through the parameter FUNC-see above.  The subroutine is
  314.                   defined using the follwing FORTRAN statement:
  315.  
  316.                      SUBROUTINE [FUNC] (X,Y,YPRIME,NEQN)
  317.  
  318.                   where the parameters have the following definitions:
  319.  
  320.                   X (Real)
  321.                       Contains the current value of X as set in RUNKUT. Do
  322.                       not alter this value within [func]
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.                   Y (Real - array of size NEQN)
  338.                       Contains the current solutions at X. Do not alter in
  339.                       [func].
  340.  
  341.                   YPRIME (Real - array of size NEQN)
  342.                       YPRIME is set in the subroutine to the differentials
  343.                       dy/dx as follows:
  344.  
  345.                          YPRIME(1) = F/1/(X,Y(1),...,Y(NEQN))
  346.                          .
  347.                          .
  348.                          YPRIME(NEQN)=F/NEQN/(X,Y(1),...,Y(NEQN))
  349.  
  350.                          where F/i/ is the i'th differential function.
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.                         1. RUNKUT - AN INITIAL VALUE ORDINARY DIFFERENTIAL
  359.               EQUATION           SOLVER.
  360.  
  361.  
  362.  
  363.                         1.1. INTRODUCTION
  364.  
  365.                         RUNKUT is a subroutine that contains three
  366.               Runge-Kutta initial           value ordinary differential
  367.               equation (IVP ODE) solvers They are:
  368.  
  369.                         -   A fourth order Fehlberg method.            -
  370.               A fifth order Verner method.            -   An seventh order
  371.               Verner method.
  372.  
  373.                         RUNKUT solves coupled IV ODE's of the form:
  374.  
  375.                              Y' = F(x,Y)
  376.  
  377.                         There is no limit to the number of coupled
  378.               equations in a system           to be solved other than the
  379.               amount of memory available. The           differential
  380.               equations are defined in a user-supplied
  381.               subroutine--more about that later.  The subroutine is called
  382.               using the following FORTRAN call statement:
  383.  
  384.                                 CALL
  385.               RUNKUT(XA,Y,XB,NEQN,TOLA,TOLR,HSTART,WORK,                 &        
  386.               IMETH,IERROR,ICOM,FUNC)
  387.  
  388.                         and must be called from a main "calling" program.
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.                         1.2. VARIABLES PASSED TO RUNKUT.
  404.  
  405.                         The variables passed are explained below and are
  406.               listed in the           order in which they appear in the
  407.               call statement. The           superscripted numbers refer to
  408.               notes appearing at the end of this           section.
  409.  
  410.                         XA (Real-Input)               XA is the starting
  411.               point of the interval over which               integration of
  412.               the ODE's is to be performed.(1)
  413.  
  414.                         Y (Real array of size NEQN - Input/Output)
  415.               On entry, Y must contain the initial values of the
  416.               Y-variables--that is Y must contain the solutions at the
  417.               point XA. On exit from RUNKUT, Y will contain the solutions
  418.               at the end of the specified interval--that is at XB.(2)
  419.  
  420.                         XB (Real-Input)               XB specifies the end
  421.               of the interval over which integration               is to be
  422.               performed--the point at which solutions to the
  423.               differential equations are desired.(1,2)
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.                         NEQN (Integer-Input)               NEQN specifies
  439.               the number of coupled differential equations               in
  440.               the system to be solved.
  441.  
  442.                         TOLA (Real-Input)               TOLA is the
  443.               absolute error tolerance required on the
  444.               solution.(3)
  445.  
  446.                         TOLR (Real-Input)               TOLR is the
  447.               relative error tolerance required on the
  448.               solution.(3)
  449.  
  450.                         HSTART (Real-Input/Output)               On the
  451.               very first call to RUNKUT in a calling sequence,
  452.               HSTART must contain a non-zero value as an initial estimate
  453.               for the step-size.(1) The actual value used is relatively
  454.               unimportant as the program will optimize step-sizes to keep
  455.               the tolerances within specified limits and keep the number of
  456.               function evaluations to a minimum. It is left to the user's
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.               discretion to choose a value that will not require excessive
  470.               readjustment by the program.  On exit from RUNKUT, this
  471.               variable will contain the last step size used by the program.
  472.               It is recommended that for subsequent calls to RUNKUT, the
  473.               step size returned by the program be used as the value for
  474.               HSTART to solve the equations over the immediately following
  475.               interval.
  476.  
  477.                         WORK (Real array of minimum size NEQN*17 - Input)
  478.               This is a work area made available to RUNKUT by the calling
  479.               program.
  480.  
  481.                         IMETH (Integer-Input)               Indicates to
  482.               the solver, the order of the method to be used.
  483.               IMETH can take on the following values:
  484.  
  485.                             1.  - Fourth order Fehlberg method
  486.               2.  - fifth order Verner method               3.  - seventh
  487.               order Verner method
  488.  
  489.                             While solving a given set of differential
  490.               equations it is               possible to change the order of
  491.               the method over sucessive               intervals simply by
  492.               setting IMETH to the desired value and
  493.               resetting ICOM(1) to 0 on each subsequent call to RUNKUT in
  494.               which a change of order is required.(4)
  495.  
  496.                         IERROR (Integer-Output)               IERROR is an
  497.               error status indicator returned by RUNKUT after
  498.               each call.  It can have one of the following values:
  499.  
  500.                             0 - no error.                1 - the sum of
  501.               TOLA and TOLR is less than 100 times machine
  502.               epsilon. This can be caused by setting both TOLA and TOLR
  503.               to 0, or by specifying values that are too small for the
  504.               program to handle sucessfully. In this case TOLR is set
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.                                 to a default value.                2 - the
  518.               problem is too stiff for the method to handle, or
  519.               there is a discontinuity in the function. It is
  520.               impossible to proceed in either case.(2)               3 -
  521.               both conditions 1 and 2 above have occured.
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.                             IERROR is set to 0 on every entry to RUNKUT.
  536.  
  537.                         ICOM (Integer array of size 4)               ICOM
  538.               is a communications vector.  Each array element is used
  539.               to pass a specific item of information (as defined below) to
  540.               and from the subroutine.
  541.  
  542.                         ICOM(1) (Input)               ICOM(1) must be set
  543.               to 0 on the first call to RUNKUT.                ICOM(1) is
  544.               internally set to a non-zero value by the program
  545.               after the first call. For subsequent calls to RUNKUT with the
  546.               same set of equations, ICOM(1) must be left at this non-zero
  547.               value. It is possible to change the order of the method used
  548.               (see also IMETH) over sucessive intervals. In this case
  549.               ICOM(1) must be reset to 0 each time the order of the method
  550.               is changed.(4)
  551.  
  552.                         ICOM(2) (Input)               A flag that indicates
  553.               to the program whether to perform               checks on the
  554.               specified values of TOLA and TOLR.
  555.  
  556.                             0 - no checking  of the error tolerances.
  557.               1 - program checks if the sum of TOLA and TOLR is at least
  558.               100 times machine epsilon. If not, TOLR is set to a
  559.               default value and the error indicator IERROR is set to 1.
  560.  
  561.                             If ICOM(2) is set to 0, the program assumes
  562.               that it will be               receiving non-zero values of at
  563.               least one of TOLA or TOLR.                Failure to check
  564.               this before entry to RUNKUT could result in
  565.               fatal program errors.  Also, as will be shown in an example,
  566.               decreasing the error tolerances does not always result in
  567.               improved solution accuracy.
  568.  
  569.                         ICOM(3) (Input)               A flag that indicates
  570.               to the program whether to use the               default
  571.               values of mimimum and maximum step size set by the
  572.               subroutine.(5)
  573.  
  574.                             0 - default values of the maximum and minimum
  575.               step size are                   used.                1 -
  576.               allows the user to set values for the maximum and minimum
  577.               permissible step size. These values are set by including
  578.               the following FORTRAN common block statement in the main
  579.               "calling" program:
  580.  
  581.                                    COMMON /CONS/HMIN,HMAX
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.                             ICOM(4) (Output)                   Status flag
  602.               that indicates the presence of round-off
  603.               error in the solution.                    0 - No round-off
  604.               error.                    1 - Severe round-off error possible
  605.               in answer.
  606.  
  607.                                 ICOM(4) is reset to 0 on entry to RUNKUT.
  608.  
  609.                             FUNC (Function name)                   FUNC is
  610.               replaced by the name of the subroutine that is
  611.               part of the main user routine in which the differential
  612.               equations are specified (See section on user supplied
  613.               routines). The subroutine name must be declared external
  614.               by the following FORTRAN statement:
  615.  
  616.                                    EXTERNAL [SUBROUTINE NAME].
  617.  
  618.  
  619.                             1.2.1. NOTES
  620.  
  621.                             1.  XA could be greater than XB. In other words
  622.               it is                   possible to use RUNKUT to solve the
  623.               differential                   equations in a negative
  624.               X-direction given initial values                   at XA. In
  625.               that case the step-size will also be negative.
  626.               HSTART could be specified as a negative value, but that
  627.               is not essential as the program internally adjusts the
  628.               algebraic sign of the step-size.
  629.  
  630.                             2.  If a discontinuity or extreme stiffness is
  631.               encountered,                   RUNKUT will return in XB, the
  632.               value of X closest to the                   point of
  633.               discontinuity or stiffness, at which the
  634.               solutions are still within the specified error bounds.
  635.               The array Y will then contain solutions at this value of
  636.               X.
  637.  
  638.                             3.  If the sum of TOLA and TOLR is less than
  639.               100 times                   machine epsilon (for example if
  640.               neither were defined in                   the main program),
  641.               TOLR is set to a default value of                   10(6)
  642.               times machine epsilon. TOLA is not set to any
  643.               default value. The program uses a combination of TOLA and
  644.               TOLR to determine the accuracies of the solutions, and
  645.               specifying TOLR to a certain value almost always gives
  646.               better results than specifying TOLA to the same value.
  647.  
  648.                             4.  Changing the order of the method on every
  649.               subsequent call                   to RUNKUT with a given
  650.               system of equations can lead to                   excessive
  651.               computaion times since a large number of
  652.               constants are re-evaluated each time the order is
  653.               changed.
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.                             5.  The default values used by the subroutine
  668.               are 10(-8) for                   HMIN, and for HMAX as
  669.               follows:
  670.  
  671.                                 0.5 - if the fourth order method is used.
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.                                 1.0 - if the fifth order method is used.
  685.               2.0 - if the seventh order method is used.
  686.  
  687.                                 However, if any of these values are larger
  688.               than the                   absolute value of the interval
  689.               width, HMAX is set to the                   interval width.
  690.               It is sometimes necessary to specify HMAX
  691.               to a small value to keep the step sizes to relatively
  692.               small values that keep the runge-kutta methods within
  693.               regions of stability. The subroutine detects the onset of
  694.               problem "stiffness" or the occurence of a discontinuity
  695.               in the function by checking if the step size is smaller
  696.               than HMIN. If the equations are being solved in the
  697.               negative X-direction, HMIN and HMAX are the smallest and
  698.               largest permissible step sizes in the negative
  699.               X-direction respectively.  In other words, HMIN and HMAX
  700.               always define absolute constraints on the step size.
  701.  
  702.                             6.  Machine epsilon on the IBM PC is very much
  703.               a function of                   the compiler used (even with
  704.               an 8087 math coprocessor                   installed). For
  705.               example Microsoft's Fortran-77 compiler
  706.               (with 8087 support) generates an epsilon of about
  707.               10(-16), whereas IBM/Ryan-McFarland's Professional
  708.               Fortran-77 generates an epsilon of about 10(-20)
  709.  
  710.  
  711.  
  712.                             1.3. THE USER-SUPPLIED ROUTINES
  713.  
  714.                             Two routines must be supplied:
  715.  
  716.                             1.  A main "calling" program that calls RUNKUT.
  717.               It must also                   define the initial values of Y
  718.               at XA, set TOLA and TOLR,                   set ICOM(1) to 0
  719.               on the first call to RUNKUT, define the
  720.               number of equations in the sytstem to be solved,
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.               dimension a WORK array for RUNKUT, and check for the
  734.               error status as passed back from RUNKUT through IERROR.
  735.               See the examples at the end of this section.
  736.  
  737.  
  738.                             2.  A subroutine containing the system of
  739.               differential                   equations.  The subroutine
  740.               name must be declared EXTERNAL                   in the main
  741.               calling program and its name passed to RUNKUT
  742.               through the parameter FUNC-see above.  The subroutine is
  743.               defined using the follwing FORTRAN statement:
  744.  
  745.                                    SUBROUTINE [FUNC] (X,Y,YPRIME,NEQN)
  746.  
  747.                                 where the parameters have the following
  748.               definitions:
  749.  
  750.                                 X (Real)                       Contains the
  751.               current value of X as set in RUNKUT. Do
  752.               not alter this value within [func]
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.                                 Y (Real - array of size NEQN)
  768.               Contains the current solutions at X. Do not alter in
  769.               [func].
  770.  
  771.                                 YPRIME (Real - array of size NEQN)
  772.               YPRIME is set in the subroutine to the differentials
  773.               dy/dx as follows:
  774.  
  775.                                        YPRIME(1) = F/1/(X,Y(1),...,Y(NEQN))
  776.               .                           .
  777.               YPRIME(NEQN)=F/NEQN/(X,Y(1),...,Y(NEQN))
  778.  
  779.                                        where F/i/ is the i'th differential
  780.               function.
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793. 
  794.